package com.ianmoone.JZOF;

import java.util.Scanner;

public class XunLeiTest2 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		in.nextLine();
		int n = 0;
		int num = 0;
		if (Math.abs(a)>Math.abs(b)) {
			n = Math.abs(a)/Math.abs(b);
			n = n > 6 ? 6 : n;
			n++;
		}else {
			n = Math.abs(b)/Math.abs(a);
			n = n > 6 ? 6 : n;
		}
			num = 2 * (7-n);
		System.out.println(a*(17-num)+b*num);
	}
}
